package com.java2018.springmvc.book.exception;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class MyGlobalException {
    @ExceptionHandler
    public String showError(Exception ex, Model model){
        System.out.println("全局异常捕获");
        model.addAttribute("exception",ex);
        return "error/error";
    }
}
